import random
def ran(n): 
    if n >90:         
        return 'A'
    elif 80 < n < 90:
        return 'B'
    elif 70 < n < 80:
        return 'C'
    else:
        return 'D'

def main():
    for i in range(1,21):       #使下方的print的内容循坏20行输出
        score=random.randint(1,100)   
        print('得分%s,等级为%s'%(score,ran(score))) 
main()       